//
//  OrderItemFrame.m
//  JiaoX
//
//  Created by yinqy on 15/1/15.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "OrderItemFrame.h"
#import "OrderProdItemView.h"

@implementation OrderItemFrame


-(void)setOrderItem:(OrderListItem *)orderItem{
    JXLog(@"setOrderItem");
    
    _orderItem = orderItem;
    
    CGSize orderCodeSize = [[NSString stringWithFormat:@"订单号：%@",orderItem.orderCode] sizeWithFont:[UIFont systemFontOfSize:ORDER_CODE_FONT_SIZE]];
    self.orderCodeFrame = CGRectMake(JXPublicInset, 20, orderCodeSize.width+JXPublicInset, orderCodeSize.height);
    
    
    CGSize orderStatusSize = [@"未支付" sizeWithFont:[UIFont systemFontOfSize:ORDER_CODE_FONT_SIZE]];
    self.orderStatusFrame = CGRectMake(JXScreenW-JXPublicInset-orderStatusSize.width, 20, orderStatusSize.width, orderStatusSize.height);
    
    
    self.orderTimeFrame = CGRectMake(JXPublicInset*2, CGRectGetMaxY(self.orderStatusFrame)+JXPublicInset/2, JXScreenW-JXPublicInset*2, ORDER_TITME_FONT_SIZE);
    
    self.orderSplit1Frame = CGRectMake(JXPublicInset, CGRectGetMaxY(self.orderTimeFrame)+JXPublicInset, JXScreenW-JXPublicInset, 0.5);
    
    self.orderProd1Frame = CGRectMake(0, CGRectGetMaxY(self.orderSplit1Frame), JXScreenW, ORDER_ITEM_VIEW_HEIGHT);
    
    if (orderItem.prodList.count>1) {
        self.orderSplit2Frame = CGRectMake(ORDER_ITEM_VIEW_HEIGHT, CGRectGetMaxY(self.orderProd1Frame), JXScreenW-ORDER_ITEM_VIEW_HEIGHT, 0.5);
        self.orderProd2Frame = CGRectMake(0, CGRectGetMaxY(self.orderSplit2Frame), JXScreenW, ORDER_ITEM_VIEW_HEIGHT);
    }else{
        self.orderProd2Frame = CGRectMake(0,CGRectGetMaxY(self.orderProd1Frame)+0.5,JXScreenW,0);
        self.orderSplit2Frame = CGRectMake(ORDER_ITEM_VIEW_HEIGHT, CGRectGetMaxY(self.orderProd1Frame), JXScreenW-ORDER_ITEM_VIEW_HEIGHT, 0);
    }
    
    self.orderSplit3Frame = CGRectMake(JXPublicInset, CGRectGetMaxY(self.orderProd2Frame), JXScreenW-JXPublicInset, 0.5);
    
    self.orderEnterFrame = CGRectMake(JXScreenW-JXPublicInset-[DimensUtils getScaleX:87], CGRectGetMaxY(self.orderSplit3Frame)+JXPublicInset, [DimensUtils getScaleX:87], [DimensUtils getScaleX:32]);
    
    self.orderAllPriceFrame = CGRectMake(JXPublicInset, CGRectGetMaxY(self.orderSplit3Frame)+JXPublicInset, JXScreenW-self.orderEnterFrame.size.width-JXPublicInset*3, ORDER_CODE_FONT_SIZE);
    
    self.prodCountFrame = CGRectMake(JXPublicInset, CGRectGetMaxY(self.orderAllPriceFrame)+JXPublicInset/2, self.orderAllPriceFrame.size.width, ORDER_TITME_FONT_SIZE);
    
    self.selfFrame = CGRectMake(0, 0, JXScreenW, CGRectGetMaxY(self.orderEnterFrame)+JXPublicInset*2);
}

@end
